<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <title></title>
    <link rel="stylesheet" href="css/index.css" />
    <script src="lib/jquery-3.1.1.min.js"></script>
    <script src="lib/vue.js"></script>
    <script src="app/index.js"></script>
</head>
<body>
<div class="header">
    <a href="javascript:void(0)" class="header_sort iconfont">&#xe96f;</a>
    <a href="index.html" class="header_title">友汇</a>
    <a href="javascript:void(0)" class="header_sort2 iconfont">&#xe8d4;</a>
    <a href="search_commodity.html" class="header_search iconfont">&#xe8bb;</a>
</div>
<ul class="center" id="app">
    <li><a href="index.html">发现</a></li>
    <li style="border-bottom: 0.07rem solid #ff4f64;"><a href="beauty_care.html">极致美肤</a></li>
    <li><a href="selfhood.html">个性配饰</a></li>
    <li><a href="hotsell.html">本周热卖</a></li>
</ul>
<!--极致美护-->
<div class="selling-box" id="sellBox">
    <div class="selling" v-for="(list,index) in objList">
        <a :href="href" @click="getId(index)"><img :src="list.img" class="selling-bg" /></a>
        <div>
            <p>{{list.name}}</p>
            <p>{{list.shortDescription}}</p>
            <p>一手价：<span>￥<span>{{list.salePrice}}</span></span></p>
        </div>
        <span>热销</span>
    </div>
   <!-- <div class="selling">
        <a href="commodity.html"><img src="img/beauty_img2.png" class="selling-bg" /></a>
        <div>
            <p>缔造美丽神话美肤水(240ML)</p>
            <p>女性的美丽，为您量身而做，拥有属于自己独一无二的味道，童话...</p>
            <p>一手价：<span>￥206.00</span></p>
        </div>
        <span>热销</span>
    </div>-->
</div>
</body>
</html>
<script>
    var commonUrl = 'http://172.30.31.254:8080/youhuishop/';
    var idNum,vm;
    $.ajax({
        url:commonUrl + 'api/goods/list',
        type:'get',
        dataType:'json',
        data:{
            currentPage:1,
            type:0
        },
        success:function (data) {
            console.log(data);
            vm=new Vue({
                el:'#sellBox',
                data:{
                    objList:data.data.objList,
                    href:"commodity.html?id="
                },
                methods:{
                    getId:function (index) {
                        idNum = data.data.objList[index].id;
                        vm.href += idNum
                    }
                }
            })
        }
    })

</script>